class MusicPlayer:
    instance = None

    def __new__(cls, *args, **kwargs):
        # 1.创建对象是new 方法会被自动调用
        print("创建对象分配空间")
        if cls.instance is None:
            print("赋值一次")
            cls.instance = super().__new__(cls)
        return cls.instance

    def __init__(self):
        print("播放器初始化")


musicPlayer = MusicPlayer()
print(musicPlayer)
musicPlayer1 = MusicPlayer()
print(musicPlayer1)
